<?php

require './src/bootstrap.php';

$actionField = Brothen::getConfig('action_field');
$hit = false;
if (Brothen::verifyToken() && !empty($_GET[$actionField])) {
    $glist = Brothen::getGList();
    switch ($_GET[$actionField]) {
        case 'list' :
            $hit = true;
            header('Content-Type: text/plain');
            echo $glist->getOutputData();
            break;
        case 'raw' :
            $hit = true;
            header('Content-Type: text/plain');
            echo $glist->getOutputData(false);
            break;
    }
}

if (!$hit) {
    header("HTTP/1.1 404 Not Found");
    if (is_file('404.php'))
        require '404.php';
}
